<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Chef::Knife::GithubBase

    &mdash; Knife Github utilities

</title>

  <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../../';
  framesUrl = "../../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">

    <a href="../../_index.html">Index (G)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../Chef.html" title="Chef (class)">Chef</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Knife</a></span></span>
     &raquo;
    <span class="title">GithubBase</span>


  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">

    <a class="full_list_link" id="class_list_link"
        href="../../class_list.html">
      Class List
    </a>

    <a class="full_list_link" id="method_list_link"
        href="../../method_list.html">
      Method List
    </a>

    <a class="full_list_link" id="file_list_link"
        href="../../file_list.html">
      File List
    </a>

</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Module: Chef::Knife::GithubBase



</h1>

<dl class="box">








    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/chef/knife/github_base.rb</dd>

</dl>
<div class="clear"></div>









    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">

        <li class="public ">
  <span class="summary_signature">

      <a href="#included-class_method" title="included (class method)">+ (Object) <strong>included</strong>(includer) </a>



  </span>









    <span class="summary_desc"><div class='inline'></div></span>

</li>


    </ul>




  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>


      <div class="method_details first">
  <h3 class="signature first" id="included-class_method">

    + (<tt>Object</tt>) <strong>included</strong>(includer)





</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/chef/knife/github_base.rb', line 26</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span><span class='lparen'>(</span><span class='id identifier rubyid_includer'>includer</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_includer'>includer</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>

    <span class='id identifier rubyid_deps'>deps</span> <span class='kw'>do</span>
      <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>chef/mixin/shell_out</span><span class='tstring_end'>'</span></span>
      <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mixlib/versioning</span><span class='tstring_end'>'</span></span>
    <span class='kw'>end</span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_url</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_url URL</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>URL of the github enterprise appliance</span><span class='tstring_end'>&quot;</span></span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_organizations</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_org ORG:ORG</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Lookup chef cookbooks in this colon-separated list of organizations</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:proc</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_o'>o</span><span class='op'>|</span> <span class='id identifier rubyid_o'>o</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_link</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_link TYPE</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Link type: ssh, http, git (dafault: ssh)</span><span class='tstring_end'>&quot;</span></span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_api_version</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_api_ver VERSION</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Version number of the API (default: v3)</span><span class='tstring_end'>&quot;</span></span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_ssl_verify_mode</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_ssl_verify_mode</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SSL verify mode: verify_peer, verify_none (default: verify_peer)</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:boolean</span> <span class='op'>=&gt;</span> <span class='kw'>true</span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_tmp</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_tmp PATH</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>A path where temporary files for the diff function will be made default: /tmp/gitdiff)</span><span class='tstring_end'>&quot;</span></span>

    <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_no_update</span><span class='comma'>,</span>
           <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_no_update</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Turn github update checking off</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
           <span class='symbol'>:boolean</span> <span class='op'>=&gt;</span> <span class='kw'>true</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_validate_base_options'>validate_base_options</span>
      <span class='kw'>unless</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_url</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Github URL not specified</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
      <span class='kw'>end</span>
      <span class='kw'>unless</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_organizations</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Github organization(s) not specified</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
      <span class='kw'>end</span>
      <span class='kw'>unless</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_no_update</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_check_gem_version'>check_gem_version</span>
      <span class='kw'>end</span>

      <span class='ivar'>@github_url</span>             <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_url</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='ivar'>@github_organizations</span>   <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_organizations</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='ivar'>@github_link</span>            <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_link</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh</span><span class='tstring_end'>'</span></span>
      <span class='ivar'>@github_api_version</span>     <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_api_version</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>v3</span><span class='tstring_end'>'</span></span>
      <span class='ivar'>@github_ssl_verify_mode</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_ssl_verify_mode</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>verify_peer</span><span class='tstring_end'>'</span></span>
      <span class='ivar'>@github_tmp</span>             <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_tmp</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/var/tmp/gitdiff</span><span class='tstring_end'>'</span></span>
      <span class='ivar'>@github_tmp</span>             <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_check_gem_version'>check_gem_version</span>
      <span class='id identifier rubyid_url'>url</span>  <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http://rubygems.org/api/v1/gems/knife-github.json</span><span class='tstring_end'>'</span></span>
      <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>curl -L -s </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_end'>`</span></span>
      <span class='kw'>begin</span>
        <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_webversion'>webversion</span> <span class='op'>=</span> <span class='const'>Mixlib</span><span class='op'>::</span><span class='const'>Versioning</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>version</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_thisversion'>thisversion</span> <span class='op'>=</span> <span class='const'>Mixlib</span><span class='op'>::</span><span class='const'>Versioning</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Knife</span><span class='op'>::</span><span class='const'>Github</span><span class='op'>::</span><span class='const'>VERSION</span><span class='rparen'>)</span>
        <span class='kw'>if</span> <span class='id identifier rubyid_webversion'>webversion</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_thisversion'>thisversion</span>
          <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: New version (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_webversion'>webversion</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'>) of knife-github is available!</span><span class='tstring_end'>&quot;</span></span>
          <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: Turn off this message with --github_no_update or add knife[:github_no_update] = true to your configuration</span><span class='tstring_end'>&quot;</span></span>
        <span class='kw'>end</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gem_local_version    : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_thisversion'>thisversion</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gem_repo_version     : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_webversion'>webversion</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gem_downloads        : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>version_downloads</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gem_total_downloads  : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>downloads</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>

      <span class='kw'>rescue</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: Cannot verify gem version information from rubygems.org</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: Turn off this message with --github_no_update or add knife[:github_no_update] = true to your configuration</span><span class='tstring_end'>&quot;</span></span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_display_debug_info'>display_debug_info</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_url           : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_url</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_org           : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_organizations</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_api           : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_link          : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_link</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_ssl_mode      : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_ssl_verify_mode</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
      <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Config</span><span class='lbracket'>[</span><span class='symbol'>:knife</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span>  <span class='id identifier rubyid_get_repo_clone_link'>get_repo_clone_link</span>
      <span class='id identifier rubyid_link'>link</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_link</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
      <span class='id identifier rubyid_repo_link'>repo_link</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_link'>link</span>
        <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh_url</span><span class='tstring_end'>'</span></span>
        <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>clone_url</span><span class='tstring_end'>'</span></span>
        <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>clone_url</span><span class='tstring_end'>'</span></span>
        <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>svn</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>svn_url</span><span class='tstring_end'>'</span></span>
        <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>html</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>html_url</span><span class='tstring_end'>'</span></span>
        <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git_url</span><span class='tstring_end'>'</span></span>
        <span class='kw'>else</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh_url</span><span class='tstring_end'>'</span></span>
      <span class='kw'>end</span>
      <span class='kw'>return</span> <span class='id identifier rubyid_repo_link'>repo_link</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lparen'>(</span><span class='id identifier rubyid_orgs'>orgs</span><span class='rparen'>)</span>
      <span class='comment'># Parse every org and merge all into one hash
</span>      <span class='id identifier rubyid_repos'>repos</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
      <span class='id identifier rubyid_orgs'>orgs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_org'>org</span><span class='op'>|</span>
        <span class='id identifier rubyid_get_repos'>get_repos</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_repo'>repo</span><span class='op'>|</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_repo'>repo</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='semicolon'>;</span> <span class='id identifier rubyid_repos'>repos</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_repo'>repo</span> <span class='rbrace'>}</span>
      <span class='kw'>end</span>
      <span class='id identifier rubyid_repos'>repos</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_repos'>get_repos</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_dns_name'>dns_name</span>  <span class='op'>=</span> <span class='id identifier rubyid_get_dns_name'>get_dns_name</span><span class='lparen'>(</span><span class='ivar'>@github_url</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HOME</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>/.chef/.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dns_name'>dns_name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_org'>org</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>

      <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span>  <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_json_updated'>json_updated</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>updated_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_org'>org</span><span class='rbrace'>}</span><span class='tstring_content'> - cache created at : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json_updated'>json_updated</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_repo_updated'>repo_updated</span> <span class='op'>=</span> <span class='id identifier rubyid_get_org_updated_time'>get_org_updated_time</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_org'>org</span><span class='rbrace'>}</span><span class='tstring_content'> - repos updated at : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_repo_updated'>repo_updated</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>

 <span class='kw'>unless</span> <span class='id identifier rubyid_json_updated'>json_updated</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_repo_updated'>repo_updated</span>
          <span class='comment'># update cache file
</span>          <span class='id identifier rubyid_create_cache_file'>create_cache_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.cache</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
          <span class='id identifier rubyid_create_cache_json'>create_cache_json</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
        <span class='kw'>end</span>
      <span class='kw'>else</span>
        <span class='id identifier rubyid_create_cache_file'>create_cache_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.cache</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_create_cache_json'>create_cache_json</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='kw'>end</span>

      <span class='comment'># use cache files
</span>      <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.cache</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_create_cache_json'>create_cache_json</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Updating the cache file: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file'>file</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='id identifier rubyid_url'>url</span>  <span class='op'>=</span> <span class='ivar'>@github_url</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/api/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/orgs/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_org'>org</span>
      <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
      <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
      <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_create_cache_file'>create_cache_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Updating the cache file: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file'>file</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_get_repos_github'>get_repos_github</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_org_updated_time'>get_org_updated_time</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_url'>url</span>  <span class='op'>=</span> <span class='ivar'>@github_url</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/api/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/orgs/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_org'>org</span>
      <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
      <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
      <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>updated_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_repos_github'>get_repos_github</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
      <span class='comment'># Get all repo's for the org from github
</span>      <span class='id identifier rubyid_arr'>arr</span>  <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
      <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='int'>1</span>
      <span class='id identifier rubyid_url'>url</span>  <span class='op'>=</span> <span class='ivar'>@github_url</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/api/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/orgs/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_org'>org</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/repos</span><span class='tstring_end'>&quot;</span></span>
      <span class='kw'>while</span> <span class='kw'>true</span>
        <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>page</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_page'>page</span> <span class='rbrace'>}</span>
        <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
        <span class='kw'>break</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span>
        <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
          <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
            <span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_get_tags'>get_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
            <span class='id identifier rubyid_key'>key</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_tags'>tags</span> <span class='kw'>unless</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
            <span class='id identifier rubyid_key'>key</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_tag</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_get_latest_tag'>get_latest_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_tags'>tags</span><span class='rparen'>)</span>
            <span class='id identifier rubyid_arr'>arr</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_key'>key</span>
          <span class='kw'>else</span>
            <span class='id identifier rubyid_arr'>arr</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_key'>key</span>
          <span class='kw'>end</span>
        <span class='rbrace'>}</span>
        <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>+</span> <span class='int'>1</span>
      <span class='kw'>end</span>
      <span class='id identifier rubyid_arr'>arr</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_tags'>get_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_repo'>repo</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
      <span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_repo'>repo</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_tags'>tags</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_latest_tag'>get_latest_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_tags'>tags</span><span class='rparen'>)</span>
      <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
      <span class='id identifier rubyid_tags_arr'>tags_arr</span> <span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
      <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tag'>tag</span><span class='op'>|</span>
        <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mixlib</span><span class='op'>::</span><span class='const'>Versioning</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(\d*)\.(\d*)\.(\d*)$</span><span class='regexp_end'>/</span></span>
      <span class='kw'>end</span>
      <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
      <span class='kw'>return</span> <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_dns_name'>get_dns_name</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='id identifier rubyid_url'>url</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
      <span class='kw'>unless</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
        <span class='id identifier rubyid_params_arr'>params_arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
        <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span>
          <span class='id identifier rubyid_params_arr'>params_arr</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span> <span class='op'>+</span> <span class='const'>CGI</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>+</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%20</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%20</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
        <span class='rbrace'>}</span>
        <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_params_arr'>params_arr</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&amp;</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_content'>?</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_data'>data</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
      <span class='kw'>end</span>

      <span class='kw'>if</span> <span class='ivar'>@github_ssl_verify_mode</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>verify_none</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:ssl_verify_mode</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='symbol'>:verify_none</span>
      <span class='kw'>elsif</span> <span class='ivar'>@github_ssl_verify_mode</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>verify_peer</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:ssl_verify_mode</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='symbol'>:verify_peer</span>
      <span class='kw'>end</span>

      <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>URL: </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>

      <span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_req_body'>req_body</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Get</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>REST</span><span class='op'>::</span><span class='const'>RESTRequest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>GET</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_req_body'>req_body</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>

      <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>

      <span class='kw'>unless</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTPOK</span><span class='rparen'>)</span> <span class='kw'>then</span>
        <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Error </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='rbrace'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_puts'>puts</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>URL: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
      <span class='kw'>end</span>

      <span class='kw'>begin</span>
        <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
      <span class='kw'>rescue</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The result on the RESTRequest is not in json format</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Output: </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
        <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
      <span class='kw'>end</span>
      <span class='kw'>return</span> <span class='id identifier rubyid_json'>json</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_get_clone'>get_clone</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_cookbook'>cookbook</span><span class='rparen'>)</span>
        <span class='kw'>if</span> <span class='op'>!</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span> <span class='ivar'>@github_tmp</span>
           <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_mkdir'>mkdir</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='kw'>end</span>
        <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_mkdir'>mkdir</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_content'>/git</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Getting </span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_content'> from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git clone </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_content'>/git/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook'>cookbook</span><span class='rbrace'>}</span><span class='tstring_content'> 2&gt;&amp;1</span><span class='tstring_end'>`</span></span>
        <span class='kw'>if</span> <span class='gvar'>$?</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span>
           <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not clone the repository for: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook'>cookbook</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
           <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_remove_entry'>remove_entry</span><span class='lparen'>(</span><span class='ivar'>@github_tmp</span><span class='rparen'>)</span>
           <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
        <span class='kw'>end</span>
        <span class='kw'>return</span> <span class='kw'>true</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_add_tag'>add_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_cpath'>cpath</span> <span class='op'>=</span> <span class='id identifier rubyid_cookbook_path_valid?'>cookbook_path_valid?</span><span class='lparen'>(</span><span class='ivar'>@cookbook_name</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
        <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_chdir'>chdir</span><span class='lparen'>(</span><span class='id identifier rubyid_cpath'>cpath</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Adding tag</span><span class='tstring_end'>&quot;</span></span>
        <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git tag -a &quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'>&quot; -m &quot;Added tag </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'>&quot; 2&gt;&amp;1</span><span class='tstring_end'>`</span></span>
        <span class='kw'>if</span> <span class='gvar'>$?</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span>
           <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not add tag for: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
           <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_remove_entry'>remove_entry</span><span class='lparen'>(</span><span class='ivar'>@github_tmp</span><span class='rparen'>)</span>
           <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
        <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>def</span> <span class='id identifier rubyid_cookbook_path_valid?'>cookbook_path_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_name'>cookbook_name</span><span class='comma'>,</span> <span class='id identifier rubyid_check_exists'>check_exists</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_cookbook_path'>cookbook_path</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:cookbook_path</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Config</span><span class='lbracket'>[</span><span class='symbol'>:cookbook_path</span><span class='rbracket'>]</span>
      <span class='kw'>if</span> <span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please specify a cookbook path</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
      <span class='kw'>end</span>

      <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
        <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot find the directory: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
      <span class='kw'>end</span>

      <span class='id identifier rubyid_cookbook_path'>cookbook_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span><span class='id identifier rubyid_cookbook_name'>cookbook_name</span><span class='rparen'>)</span>
      <span class='kw'>if</span> <span class='id identifier rubyid_check_exists'>check_exists</span>
          <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='rparen'>)</span>
            <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Processing [S] </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_name'>cookbook_name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
            <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Path to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='rbrace'>}</span><span class='tstring_content'> already exists, skipping.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
            <span class='kw'>return</span> <span class='kw'>nil</span>
          <span class='kw'>end</span>
      <span class='kw'>else</span>
          <span class='kw'>if</span> <span class='op'>!</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='rparen'>)</span>
            <span class='kw'>return</span> <span class='kw'>nil</span>
          <span class='kw'>end</span>
      <span class='kw'>end</span>
      <span class='kw'>return</span> <span class='id identifier rubyid_cookbook_path'>cookbook_path</span>
    <span class='kw'>end</span>

  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>

  </div>

</div>

    <div id="footer">
  Generated on Wed Oct 30 21:59:25 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.2 (ruby-1.9.3).
</div>

  </body>
</html>